//
//  LoginViewController.m
//  kankanVideo
//
//  Created by wangbo on 7/9/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "LoginViewController.h"
#import "WBRequest.h"
#import "SinaController.h"
//#import "WBSendView.h"
//static int i=0;
@implementation LoginViewController
@synthesize weiBoEngine;

-(IBAction)back:(id)sender{
    [self.navigationController popViewControllerAnimated:YES];
}
-(IBAction)send:(id)sender{
    NSLog(@"send:%@",weiBoEngine.accessToken);
    //[weiBoEngine sendWeiBoWithText:@"iphone_test_kankanews" image:[UIImage imageNamed:@"zhuye_bj.jpg"]];
    /*NSMutableDictionary *dict=[[NSMutableDictionary alloc]init];
    [dict setObject:weiBoEngine.accessToken forKey:@"access_token"];
    [dict setObject:[@"aaaaaaaaaa" stringByAppendingString:[NSString stringWithFormat:@"%d",i]] forKey:@"status"];
    i++;
    [weiBoEngine loadRequestWithMethodName:@"statuses/update.json" httpMethod:@"POST" params:dict postDataType:kWBRequestPostDataTypeNormal httpHeaderFields:nil];
    */
    [[SinaController shareInstance]sendWithContent:@"dsfdfsdfdafdsfsd" withImage:nil];
    NSLog(@"send_over");
}
-(IBAction)sinaLogin:(id)sender{
    NSLog(@"login");
    //NSString *ak=[[NSString alloc]initWithString:@"4281330846"];
    //NSString *as=[[NSString alloc]initWithString:@"aadc4acbe227004e391803af30fa6224"];
    [[SinaController shareInstance]login:self];
    //WBSendView *weiboSendView=[[WBSendView alloc]initWithAppKey:ak appSecret:as text:@"aaaaa" image:[UIImage imageNamed:@"zhuye_bj.jpg"]];
    //[self.view addSubview:weiboSendView];
    //[weiboSendView release];
    /*if(!weiBoEngine){
        self.weiBoEngine=[[WBEngine alloc]initWithAppKey:ak appSecret:as];
        [weiBoEngine setRootViewController:self];
        [weiBoEngine setDelegate:self];
        [weiBoEngine setRedirectURI:@"http://"];  
        [weiBoEngine setIsUserExclusive:NO]; 
        [weiBoEngine release];
        
    }
    //[weiBoEngine logInUsingUserID:@"wb95883847" password:@"game1234"];
    [weiBoEngine logIn];*/
    //NSLog(@"login_over");
    //[self.navigationController pushViewController:sinaWebView animated:YES];
}


- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    [btn setHidden:YES];
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
    [btn setHidden:YES];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

@end
